package com.core.system.service.impl;

import com.core.system.service.ISystemUserService;
import com.pojo.entity.SystemUserEntity;
import org.springframework.beans.factory.annotation.Autowired;


/**
 *  公共service
 * @author: hw
 * @date: 2020/12/23 14:53
 */

public class BaseService {

    @Autowired
    public ISystemUserService userService;




    /**
     * 获取用户id
     * @return
     */
    public Long getUserId() {
//        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
//        if (!Objects.isNull(authentication) && !Objects.isNull(authentication.getName())) {
//            SystemUserEntity user = userService.getUser(authentication.getName());
//            if (!Objects.isNull(user)) {
//                return user.getId();
//            }
//           return null;
//        }
        return null;
    }


    /**
     * 获取用户id
     * @return
     */
    public String getUserName() {
//        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
//        return authentication.getName();
        return null;
    }


    /**
     * 获取用户id
     * @return
     */
    public SystemUserEntity getUser() {
//        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
//        if (!Objects.isNull(authentication.getName())) {
//            SystemUserEntity user = userService.getUser(authentication.getName());
//            if (!Objects.isNull(user)) {
//                return user;
//            }
//            return null;
//        }
        return null;
    }







}
